﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program19
{
    class Program
    {
        static void Main(string[] args)
        {
            string name, pwd,msg;
            Console.WriteLine("请输入用户名：");
            name = Console.ReadLine();
            Console.WriteLine("请输入密码：");
            pwd = Console.ReadLine();

            var status = Login(name, pwd, out msg);
            Console.WriteLine("登陆结果：{0},提醒：{1}", status, msg);
            Console.ReadLine();
        }
        public static bool Login(string name,string pwd,out string statueMessage)
        {
            statueMessage = "登陆失败";

            if (string.IsNullOrEmpty(name))
            {
                statueMessage = "用户名不能为空，请重试";
            }
            if (string.IsNullOrEmpty(pwd))
            {
                statueMessage = "密码不能为空，请重试";
            }

            var users = new List<string>();
            users.Add("阿西吧");

            if (!users.Contains("阿西吧"))
            {
                statueMessage = "此用户名不存在，请重试";
                return false;
            }
            if(name=="阿西吧" && pwd == "123")
            {
                statueMessage = "登陆成功";
                return true;
            }
            else
            {
                statueMessage = "登陆失败，请重试";
                return false;
            }
        }
    }
}
